package org.csu.storemanage.controller;


import com.alipay.api.AlipayApiException;
import org.csu.storemanage.service.AlipayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.csu.storemanage.pojo.AlipayForm;

@Controller
public class AlipayController {
    @Autowired
    AlipayService alipay;
    @PostMapping(value = "/alipay")
    @ResponseBody
//    String outTradeNo, String subject, String totalAmount, String body
    public String alipay(AlipayForm alipayForm) throws AlipayApiException {
        System.out.println(alipayForm);
        return alipay.pay(alipayForm);
    }
}


